<%@ page import="com.rdk.utils.SystemConfig" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta charset="utf-8"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <title>出错了</title>
    <meta id="viewport" name="viewport"
          content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <link href="/resource/css/main.css" type="text/css" rel="stylesheet">
    <link href="/resource/css/iconfont.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div style="text-align: center;margin-top: 20px;" id="error"><%=request.getAttribute("error")%></div>
    <div style="text-align: center;margin-top: 20px;"><span id="time">5</span>秒后跳转到首页！</div>
</div>

<script>
    var i = 5;
    var intervalid;
    intervalid = setInterval("fun()", 1000);

    function fun() {
        if (i == 0) {
            var href = document.referrer;
            var url = "<%=SystemConfig.readValue("vrv.im.path")%>".replace("/platform/platform/", "/platform/");
            if (href.indexOf('clientKey') != -1 && document.getElementById("error").innerHTML.indexOf('用户ID为0') != -1) {
                href = url + "login?gotoUrl=<%=SystemConfig.readValue("server.path")%>";
            }
            location.href = href;
//            alert(location.href);
            <%--if (getCookie('userId')) {--%>
                <%--window.location.href = "<%=PropertiesUtil.getProperty("server.path")%>feed";--%>
            <%--} else {--%>
                <%--window.location.href = "http://im.vrv.cn/platform/login?gotoUrl=<%=PropertiesUtil.getProperty("server.path")%>";--%>
            <%--}--%>
            clearInterval(intervalid);
        }
        document.getElementById("time").innerHTML = i;
        i--;
    }

    function getCookie(cookieName) {
        var strCookie = document.cookie;
        var arrCookie = strCookie.split("; ");
        for(var i = 0; i < arrCookie.length; i++){
            var arr = arrCookie[i].split("=");
            if(cookieName == arr[0]){
                return arr[1];
            }
        }
        return "";
    }
</script>
</body>

</html>